Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nohost/connect

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nohost/connect

处理请求转发的模块

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

connect

Nohost 内部处理请求转发的模块

安装

npm i --save @nohost/connect

用法

const { getRawHeaders, request, tunnel, upgrade } = require('@nohost/connect');

API

  1. const rawHeaders = getRawHeaders(req|res):还原请求或响应头大小写
  2. const svrRes = await request(req, res, options)
    • options: 可选,目标服务器的 IP(域名)及端口
    • req:请求对象
    • res: 响应对象
    • svrRes: 上游服务响应对象
  3. tunnel(req, options):代理隧道代理
  4. upgrade(req, options):转发 WebSocket 请求

例子

参考:https://github.com/nohosts/router/blob/master/lib/connect.js

Keywords

FAQs

Package last updated on 29 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc